<style rel="stylesheet/scss" lang="scss">
.context-row {
  min-height: 600px;
  max-height: 900px;
}
.height-inherit {
  height: inherit;
}
.menu-border-left {
  border-right: unset;
}
.context-right-border {
  border: 1px solid #e6eef7;
  border-left: unset;
}
.top-5 {
  top: 5px;
}
td .el-input-number {
  max-width: 80px;
}
.price-table {
  max-height: 450px;
}
.el-menu-item i {
    color: unset;
}
.el-menu-item.is-active{
  color: #fff !important;
  background-color: #28a087 !important;
}
.el-menu-item:hover{
  color: #fff !important;
  background-color: #28a087 !important;
  i{
    color: #fff !important;
  }
}
.height-36 {
  height: 36px;
}

</style>
<template>
  <el-row type="flex" class="p-30 context-row bg-white" justify="space-around">
    <el-col :span="2">
      <el-menu
        :default-active="activeMenu"
        class="el-menu-vertical-demo full-height menu-border-left"
        background-color="#e6eef7"
        text-color="#494f54"
        active-text-color="#26A087"
      >
        <el-menu-item index="安装" @click="changeMenu('安装')">
          <i class="icon-commonyuanquyunwei"/>
          <span slot="title">安装</span>
        </el-menu-item>
        <el-menu-item index="维修" @click="changeMenu('维修')">
          <i class="icon-commonicon_shezhi"/>
          <span slot="title">维修</span>
        </el-menu-item>
        <el-menu-item index="清洗" @click="changeMenu('清洗')">
          <i class="icon-commonshuibiao"/>
          <span slot="title">清洗</span>
        </el-menu-item>
        <el-menu-item index="移机" @click="changeMenu('移机')">
          <i class="icon-commonhuowudui1"/>
          <span slot="title">移机</span>
        </el-menu-item>
        <el-menu-item index="保养" @click="changeMenu('保养')">
          <i class="icon-commontuoguan"/>
          <span slot="title">保养</span>
        </el-menu-item>
      </el-menu>
    </el-col>
    <el-col :span="7" class="context-right-border p-20">
      <el-row type="flex" align="middle" class="height-36">
        <el-col :span="24">
          <label>补贴</label>
        </el-col>
      </el-row>
      <el-row type="flex" align="middle" class="pt-10">
        <el-col :span="24">
          <el-table
            ref="allowanceTable"
            :data="allowanceData"
            empty-text="暂无数据"
            max-height="750"
            style="width: 100%">
            <el-table-column
              fixed
              label="关联下游价签"
              width="180">
              <template slot-scope="alloce">
                <i class="icon-commonranqijianceqi"/>
                <span style="margin-left: 10px">{{ (alloce.row.specificationName?(alloce.row.specificationName+"--"):"-")+(alloce.row.measureTypeName?(alloce.row.measureTypeName):"-") }}</span>
              </template>
            </el-table-column>
            <el-table-column
              label="补贴金额"
              width="180">
              <template slot-scope="alloce">
                <el-input-number
                  :precision="2"
                  :controls="false"
                  :min="-99999999.99"
                  :max="99999999.99"
                  v-model="alloce.row.orderSubsidyPricce"
                  size="small"
                  placeholder="请输入金额"
                  @change="changeAllowance(alloce.$index,alloce.row)"
                />
              </template>
            </el-table-column>
            <el-table-column label="操作" fixed="right">
              <template slot-scope="alloce">
                <el-button
                  type="primary"
                  size="small"
                  icon="el-icon-check"
                  circle
                  @click="savePriceTagList(alloce.row,'allowance')"
                />
              </template>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
    </el-col>
    <el-col :span="15" class="context-right-border p-20">
      <el-row type="flex" align="middle">
        <el-col :span="2">
          <label>选择：</label>
        </el-col>
        <el-col :span="4" class="pr-10">
          <el-select
            v-model="query.categoryId"
            filterable
            placeholder="请选择品类"
            @change="changeCategory"
          >
            <el-option
              v-for="item in categoryOptions"
              :key="item.categoryId"
              :label="item.categoryName"
              :value="item.categoryId"
            />
          </el-select>
        </el-col>
        <el-col :span="4" class="pr-10">
          <el-button type="primary" @click="addMasterPrice">添加价签</el-button>
        </el-col>
        <el-col :span="4" class="pr-10">
          <el-button type="primary" @click="savePriceTagList" >保存所有</el-button>
        </el-col>
        <el-col :span="6" class="pr-10">
          <el-select
            v-model="copyId"
            filterable
            placeholder="请选择合作商"
          >
            <el-option
              v-for="item in partnerOptions"
              :key="item.partnerCompanyId"
              :label="item.partnerCompanyName"
              :value="item.partnerCompanyId"
            />
          </el-select>
        </el-col>
        <el-col :span="4">
          <el-button type="warning" @click="copyPriceTag" >复制价签</el-button>
        </el-col>
      </el-row>
      <el-row type="flex" align="middle" class="pt-10">
        <el-col :span="24">
          <el-table ref="priceTable" :data="tableData" class="full-width" empty-text="暂无数据" max-height="750">
            <el-table-column width="280" label="服务名称">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.maintenanceServiceName"
                  placeholder="输入服务名称"
                  size="small"
                  clearable/>
              </template>
            </el-table-column>
            <el-table-column width="100" label="上游结算">
              <template slot-scope="scope">
                <el-input-number
                  :precision="2"
                  :controls="false"
                  :min="0"
                  :max="99999999.99"
                  v-model="scope.row.partnerSettlePrice"
                  size="small"
                  label="￥"
                  placeholder="请输入金额"
                />
              </template>
            </el-table-column>
            <el-table-column width="200" label="关联下游价签">
              <template slot-scope="scope">
                <el-select v-model="scope.row.serviceChargeId" filterable placeholder="选择下游价签" @change="changeCharge(scope.$index,scope.row)">
                  <el-option
                    v-for="item in priceOptions"
                    :key="item.serviceChargeId"
                    :label="item.specificationName +'--'+ item.measureTypeName"
                    :value="item.serviceChargeId">
                    <span style="float: left">{{ item.specificationName }}</span>
                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.measureTypeName }}</span>
                  </el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="下游基准">
              <template slot-scope="scope">
                <span>￥{{ scope.row.inGuaranteeCommission?(scope.row.inGuaranteeCommission).toFixed(2):"" }}</span>
              </template>
            </el-table-column>
            <el-table-column label="下游补贴" >
              <template slot-scope="scope">
                <span>￥{{ (scope.row.orderSubsidyPricce?scope.row.orderSubsidyPricce:0).toFixed(2) }}</span>
              </template>
            </el-table-column>
            <el-table-column label="下游实结">
              <template slot-scope="scope">
                <span>￥{{ (scope.row.inGuaranteeCommission+(scope.row.orderSubsidyPricce?scope.row.orderSubsidyPricce:0)).toFixed(2) }}</span>
              </template>
            </el-table-column>

            <el-table-column label="盈亏分析">
              <template slot-scope="scope">
                <span>￥{{ ((scope.row.partnerSettlePrice?scope.row.partnerSettlePrice:0)-(scope.row.inGuaranteeCommission+(scope.row.orderSubsidyPricce?scope.row.orderSubsidyPricce:0))).toFixed(2) }}</span>
              </template>
            </el-table-column>
            <el-table-column width="100" fixed="left" label="操作">
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  size="small"
                  icon="el-icon-check"
                  circle
                  @click="savePriceTag(scope.row)"
                />
                <el-button
                  type="danger"
                  size="small"
                  icon="el-icon-delete"
                  circle
                  @click="removePriceTag(scope.$index,scope.row)"
                />
              </template>
            </el-table-column>
          </el-table>

        </el-col>
      </el-row>
    </el-col>
  </el-row>

</template>

<script>
import { listPartnerOptions } from '@/api/common'
import { listPartnerCategory } from '@/api/category'
import { getSpecification } from '@/api/specification'
import { getMeasureType } from '@/api/MeasureType'
// import { getToken } from '@/utils/auth'
import {
  getPartnerMasterPrice,
  saveList,
  getChargeList,
  savePartnerMasterPrice,
  copyPartnerMasterPrice,
  removePartnerMasterPrice
} from '@/api/partnerMasterPrice'
export default {
  data() {
    return {
      tableKey: 1,
      query: {
        partnerId: '',
        categoryId: '',
        measureTypeId: '',
        specificationId: '',
        orderServiceType: '安装'
      },
      copyId: '',
      activeMenu: '安装',
      serviceChargeId: 527,
      category: {},
      specification: {},
      measureType: {},
      priceOptions: [],
      categoryOptions: [],
      partnerOptions: [],
      specificationOptions: [],
      measureTypeOptions: [],
      specificationColumn: '规格',
      masterPriceFrom: {
        masterPriceId: '',
        partnerId: '',
        categoryId: '',
        maintenanceServiceName: '',
        partnerSettlePrice: '',
        orderSubsidyPricce: '',
        serviceChargeId: ''
      },
      tableData: [],
      allowanceData: [],
      FromList: {
        newData: '',
        editData: ''
      }
    }
  },
  computed: {},
  watch: {},
  created() {
    const self = this
    self.query.partnerId = self.$route.query.partnerId
    self.loadPartnerOptions()
    self.loadCategoryOptions()
    self.loadSpecificationOptions()
  },
  methods: {
    forceRefreshTable() {
      this.tableKey = this.tableKey + 1
    },
    cleanQuery() {
      this.query = {
        partnerId: this.query.partnerId,
        categoryId: '',
        measureTypeId: '',
        specificationId: '',
        orderServiceType: this.query.orderServiceType
      }
    },
    cleanFrom() {
      this.masterPriceFrom = {
        masterPriceId: '',
        partnerId: '',
        categoryId: '',
        maintenanceServiceName: '',
        partnerSettlePrice: '',
        orderSubsidyPricce: '',
        serviceChargeId: ''
      }
    },
    changeMenu(menu) {
      var self = this
      self.query.orderServiceType = menu
      this.query.categoryId = 87
      self.loadCategoryOptions()
      self.loadSpecificationOptions()
      self.loadPriceTagTable()
      self.specificationColumn = '规格'
      if (menu === '维修') {
        self.loadgetMeasureTypeOptions()
      }
      this.forceRefreshTable()
    },
    loadCategoryOptions() {
      var self = this
      self.query.categoryId = 87
      self.categoryOptions = []
      var data = { partnerId: self.query.partnerId }
      listPartnerCategory(data)
        .then(response => {
          if (response.data.status === 'success') {
            this.categoryOptions = response.data.data
            if (this.categoryOptions && this.categoryOptions.length > 0) {
              this.query.categoryId = this.categoryOptions[0].categoryId
              this.loadPriceOptions()
              self.loadPriceTagTable()
            } else {
              this.query.categoryId = ''
            }
          } else {
            this.$message({
              message: '品类加载失败' + response.data.messge,
              type: 'warning'
            })
          }
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '网络请求失败'
          })
        })
    },
    loadPartnerOptions() {
      var self = this
      self.partnerOptions = []
      var data = {}
      listPartnerOptions(data)
        .then(response => {
          if (response.data.status === 'success') {
            this.partnerOptions = response.data.data
          } else {
            this.$message({
              message: '合作商加载失败' + response.data.messge,
              type: 'warning'
            })
          }
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '网络请求失败'
          })
        })
    },
    loadPriceOptions() {
      var self = this
      getChargeList(self.query)
        .then(response => {
          if (response.data.status === 'success') {
            if (response.data.data && response.data.data.length !== 0) {
              self.priceOptions = response.data.data
            } else {
              this.$message({
                message: '规格没有对应的基准价签，请先添加基准价签!',
                type: 'warning'
              })
            }
          } else {
            this.$message({
              message: '基准价签加载失败' + response.data.messge,
              type: 'warning'
            })
          }
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '网络请求失败'
          })
        })
    },
    loadSpecificationOptions() {
      var self = this
      self.query.specificationId = ''
      self.specificationOptions = []
      if (this.query.categoryId) {
        getSpecification(this.query.categoryId)
          .then(response => {
            if (response.data.status === 'success') {
              this.specificationOptions = response.data.data
            } else {
              this.$message({
                message: '规格加载失败' + response.data.messge,
                type: 'warning'
              })
            }
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: '网络请求失败'
            })
          })
      }
    },
    loadgetMeasureTypeOptions() {
      var self = this
      self.query.measureTypeId = ''
      self.measureTypeOptions = []
      if (self.query.orderServiceType) {
        getMeasureType(self.query.orderServiceType)
          .then(response => {
            if (response.data.status === 'success') {
              self.measureTypeOptions = response.data.data
            } else {
              self.$message({
                message: '措施加载失败' + response.data.messge,
                type: 'warning'
              })
            }
          })
          .catch(() => {
            self.$message({
              type: 'info',
              message: '网络请求失败'
            })
          })
      }
    },
    loadPriceTagTable() {
      if (this.query.partnerId && this.query.orderServiceType) {
        getPartnerMasterPrice(this.query)
          .then(response => {
            if (response.data.status === 'success') {
              this.tableData = response.data.data
              this.allowanceData = this.arrayUnique(this.tableData, 'serviceChargeId')
            } else {
              this.tableData = []
              this.allowanceData = []
              this.$message({
                message: '服务价签加载失败' + response.data.messge,
                type: 'warning'
              })
            }
          })
          .catch(() => {
            this.tableData = []
            this.allowanceData = []
            this.$message({
              type: 'info',
              message: '网络请求失败'
            })
          })
      } else {
        this.tableData = []
        this.allowanceData = []
      }
    },
    changeCategory(value) {
      if (value) {
        this.loadPriceTagTable()
        this.loadPriceOptions()
        // this.loadSpecificationOptions()
        // this.query.measureTypeId = ''
        // this.query.specificationId = ''
        let obj = {}
        obj = this.categoryOptions.find(item => {
          return item.categoryId === value
        })
        if (obj && typeof obj !== 'undefined') {
          this.category = obj
        }
      }
    },
    copyPriceTag() {
      var self = this
      if (self.copyId && self.query.partnerId) {
        copyPartnerMasterPrice({
          copyId: self.copyId,
          partnerCompanyId: self.query.partnerId
        }).then(response => {
          if (response.data.status === 'success') {
            this.loadPriceTagTable()
            this.$message({
              message: '合作商价签复制成功',
              type: 'success'
            })
          } else {
            this.$message({
              message: '合作商价签复制失败,' + response.data.messge,
              type: 'warning'
            })
          }
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '网络请求失败'
          })
        })
      } else {
        self.$message({
          type: 'warning',
          message: '请选择合作商'
        })
      }
    },
    addMasterPrice() {
      var self = this
      if (self.query.categoryId) {
        self.tableData.unshift({
          masterPriceId: null,
          partnerCompanyId: self.query.partnerId,
          categoryId: self.query.categoryId,
          categoryName: self.category.name,
          maintenanceServiceName: '',
          partnerSettlePrice: 0.0,
          orderSubsidyPricce: 0.0,
          inGuaranteeCommission: null,
          serviceChargeId: '',
          measureTypeId: null,
          measureTypeName: '',
          specificationId: null,
          specificationName: ''
        })
      } else {
        this.$message({
          type: 'warning',
          message: '请选择品类'
        })
      }
    },
    changeCharge(index, row) {
      console.log('serviceChargeId: ' + row.serviceChargeId)
      var self = this
      let obj = {}
      obj = self.priceOptions.find(item => {
        return item.serviceChargeId === row.serviceChargeId
      })
      if (obj && typeof obj !== 'undefined') {
        self.tableData[index].inGuaranteeCommission = obj.inGuaranteeCommission
        self.tableData[index].specificationId = obj.specificationId
        self.tableData[index].specificationName = obj.specificationName
        self.tableData[index].measureTypeId = obj.measureTypeId
        self.tableData[index].measureTypeName = obj.measureTypeName
        this.allowanceData = this.arrayUnique(this.tableData, 'serviceChargeId')
      }
    },
    changeAllowance(index, row) {
      var self = this
      const arr = []
      self.tableData.find(item => {
        if (item.serviceChargeId === row.serviceChargeId) {
          item.orderSubsidyPricce = row.orderSubsidyPricce
          arr.push(item)
        }
      })
      if (arr && arr.length > 0) {
        self.tableData.push.apply(self.tableData, arr)
        self.tableData = this.arrayUnique(self.tableData, 'masterPriceId')
      }
    },
    savePriceTagList(row, type) {
      // 保存多个价签---针对补贴，其他有需要批量添加的功能可以在改造一下这个方法就可以
      var self = this
      // 验证
      // 提示是否保存
      // 确定提交·
      // 取消跳过
      const newData = []
      const editData = []
      self.tableData.find(item => {
        if (type && type === 'allowance') {
          if (item.serviceChargeId === row.serviceChargeId) {
            item.orderSubsidyPricce = row.orderSubsidyPricce
            if (item.masterPriceId) {
              editData.push(item)
            } else {
              newData.push(item)
            }
          }
        } else {
          if (item.masterPriceId) {
            editData.push(item)
          } else {
            newData.push(item)
          }
        }
      })
      var list = []
      list.push.apply(list, newData)
      list.push.apply(list, editData)
      for (var i in list) {
        if (list[i].maintenanceServiceName === null || list[i].maintenanceServiceName === '') {
          self.$message({
            message: '服务名称为空',
            type: 'warning'
          })
          return
        }
        if (list[i].partnerSettlePrice === null || typeof list[i].partnerSettlePrice === 'undefined') {
          self.$message({
            message: '上游结算价格不能为空',
            type: 'warning'
          })
          return
        }
        if (list[i].orderSubsidyPricce === null || typeof list[i].orderSubsidyPricce === 'undefined') {
          self.$message({
            message: '下游补贴价格不能为空',
            type: 'warning'
          })
          return
        }
      }
      if ((newData && newData.length > 0) || (editData && editData.length > 0)) {
        self.$confirm('保存服务价签, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          self.FromList.newData = JSON.stringify(newData)
          self.FromList.editData = JSON.stringify(editData)
          var fromData = self.assemblesFromData(self.FromList)
          saveList(fromData)
            .then(response => {
              if (response.data.status === 'success') {
                self.loadPriceTagTable()
                self.$message({
                  type: 'success',
                  message: '保存服务价签成功!'
                })
              } else {
                self.$message({
                  message: '保存服务价签失败' + response.data.messge,
                  type: 'warning'
                })
              }
            })
            .catch(() => {
              self.$message({
                type: 'info',
                message: '保存服务价签失败'
              })
            })
        }).catch(() => {
          self.$message({
            type: 'info',
            message: '已取消保存'
          })
        })
      }
    },
    addMasterPriceByMeasure(value) {
      var self = this
      if (self.query.orderServiceType !== '维修') {
        return
      }
      if (!self.query.specificationId) {
        this.$message({
          type: 'warning',
          message: '请选择规格'
        })
        return
      }
      if (value) {
        self.measureType = self.measureTypeOptions.find(item => {
          return item.measureTypeId === value
        })
        let obj = {}
        obj = self.tableData.find(item => {
          return item.specificationId === self.query.specificationId && item.measureTypeId === value
        })
        if (!obj && typeof obj === 'undefined') {
          var arr = {}
          getChargeList(self.query)
            .then(response => {
              if (response.data.status === 'success') {
                if (response.data.data && response.data.data.length !== 0) {
                  arr = response.data.data
                  for (var i in response.data.data) {
                    self.tableData.push({
                      masterPriceId: null,
                      partnerCompanyId: self.query.partnerId,
                      categoryId: arr[i].categoryId,
                      maintenanceServiceName: null,
                      partnerSettlePrice: 0.0,
                      orderSubsidyPricce: 0.0,
                      inGuaranteeCommission: arr[i].inGuaranteeCommission,
                      serviceChargeId: arr[i].serviceChargeId,
                      measureTypeId: arr[i].measureTypeId,
                      measureTypeName: arr[i].measureTypeName,
                      specificationId: arr[i].specificationId,
                      specificationName: arr[i].specificationName,
                      categoryName: arr[i].categoryName
                    })
                  }
                } else {
                  this.$message({
                    message: '规格没有对应的基准价签，请先添加基准价签!',
                    type: 'warning'
                  })
                }
              } else {
                this.$message({
                  message: '基准价签加载失败' + response.data.messge,
                  type: 'warning'
                })
              }
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '网络请求失败'
              })
            })
        } else {
          var label = self.specification.specificationName + '--' + self.measureType.measureTypeName
          this.$message({
            type: 'warning',
            message: '规格' + label + '已存在服务价签'
          })
        }
      }
    },
    savePriceTag(row) {
      var self = this
      // 验证
      // 提示是否保存
      // 确定提交·
      // 取消跳过
      if (row) {
        if (row.maintenanceServiceName === null || row.maintenanceServiceName === '') {
          self.$message({
            message: '服务名称为空',
            type: 'warning'
          })
          return
        }
        if (row.serviceChargeId === null || row.serviceChargeId === '') {
          self.$message({
            message: '请选择上游价签',
            type: 'warning'
          })
          return
        }
        if (row.partnerSettlePrice === null || typeof row.partnerSettlePrice === 'undefined') {
          self.$message({
            message: '上游结算价格不能为空',
            type: 'warning'
          })
          return
        }
        if (row.orderSubsidyPricce === null || typeof row.orderSubsidyPricce === 'undefined') {
          self.$message({
            message: '下游补贴价格不能为空',
            type: 'warning'
          })
          return
        }

        self.$confirm('保存服务价签, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          self.initPriceFrom(row)
          var fromData = self.assemblesFromData(self.masterPriceFrom)
          savePartnerMasterPrice(fromData)
            .then(response => {
              if (response.data.status === 'success') {
                self.loadPriceTagTable()
                self.$message({
                  type: 'success',
                  message: '保存服务价签成功!'
                })
              } else {
                self.$message({
                  message: '保存服务价签失败' + response.data.messge,
                  type: 'warning'
                })
              }
            })
            .catch(() => {
              self.$message({
                type: 'info',
                message: '保存服务价签失败'
              })
            })
        }).catch(() => {
          self.$message({
            type: 'info',
            message: '已取消保存'
          })
        })
      }
    },
    removePriceTag(index, row) {
      var self = this
      if (row && row.masterPriceId) {
        var data = {
          masterPriceId: row.masterPriceId
        }
        this.$confirm('删除服务价签, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          removePartnerMasterPrice(data)
            .then(response => {
              if (response.data.status === 'success') {
                self.tableData.splice(index, 1)
                self.allowanceData = this.arrayUnique(self.tableData, 'serviceChargeId')
                this.$message({
                  type: 'success',
                  message: '删除服务价签成功!'
                })
              } else {
                this.$message({
                  message: '删除服务价签失败' + response.data.messge,
                  type: 'warning'
                })
              }
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '删除服务价签失败'
              })
            })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
      } else {
        this.$confirm('删除服务价签, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          self.tableData.splice(index, 1)
          self.allowanceData = this.arrayUnique(self.tableData, 'serviceChargeId')
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
      }
    },
    arrayUnique(arr, name) {
      var hash = {}
      return arr.reduce(function(item, next) {
        hash[next[name]] ? '' : hash[next[name]] = true && item.push(next)
        return item
      }, [])
    },
    initPriceFrom(row) {
      var self = this
      self.masterPriceFrom = {}
      self.masterPriceFrom.masterPriceId = row.masterPriceId
      self.masterPriceFrom.partnerCompanyId = row.partnerCompanyId
      self.masterPriceFrom.categoryId = row.categoryId
      self.masterPriceFrom.maintenanceServiceName = row.maintenanceServiceName
      self.masterPriceFrom.partnerSettlePrice = row.partnerSettlePrice
      self.masterPriceFrom.orderSubsidyPricce = row.orderSubsidyPricce
      self.masterPriceFrom.serviceChargeId = row.serviceChargeId
    },
    assemblesFromData(data) {
      var fromData = new FormData()
      if (data) {
        for (var prop in data) {
          if (data[prop] !== null) {
            fromData.append(prop, data[prop])
          } else {
            fromData.append(prop, '')
          }
        }
      }
      if (fromData) {
        return fromData
      } else {
        return new FormData()
      }
    },
    handleOpen() {},
    handleEdit(index, row) {
      console.log(index, row)
    },
    handleDelete(index, row) {
      console.log(index, row)
    }
  }
}
</script>
